{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LinearRegression  # 线性回归\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[150],\n",
       "       [200],\n",
       "       [250],\n",
       "       [300],\n",
       "       [350],\n",
       "       [400],\n",
       "       [600]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 特征 7行一列\n",
    "X = np.array([150, 200, 250, 300, 350, 400, 600])\n",
    "X = X.reshape(7,1)\n",
    "X "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = np.array([6450, 7450, 8450, 9450, 11450, 15450, 18450])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression()"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr = LinearRegression()\n",
    "lr.fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "系数 [28.77659574]\n",
      "截距 1771.8085106382969\n",
      "sklearn\n",
      " [ 6088.29787234  7527.12765957  8965.95744681 10404.78723404\n",
      " 11843.61702128 13282.44680851 19037.76595745]\n"
     ]
    }
   ],
   "source": [
    "# y = kx + b； b截距，k是系数\n",
    "print(\"系数\", lr.coef_)  # 系数\n",
    "print(\"截距\", lr.intercept_)\n",
    "\n",
    "# 算法：y = 28.77659574 * x + 1771.8085106382969\n",
    "# 之后输入x---输出预测结果\n",
    "\n",
    "# lr.predict()\n",
    "# y_pred = X*lr.coef_ + lr.intercept_\n",
    "# print(\"预测结果\\n\", y_pred)\n",
    "y_pred = lr.predict(X)\n",
    "print(\"sklearn\\n\", y_pred)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD4CAYAAADsKpHdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAApb0lEQVR4nO3deXhU9dnG8e8DBAhr2CGBEHYMiywBcQVFBVfApaWLYNViqa3Wtgi4VK1WUaxWa9FSV3yriCQCIogL7oIYRJIQCIRFSMIOYU1Clt/7x5zYECKQdTKZ+3Ndc+XkOefM/OYouecs8xxzziEiIlLL3wMQEZHqQYEgIiKAAkFERDwKBBERARQIIiLiqePvAZRVy5YtXVRUlL+HISISUFauXLnHOdeqpHkBGwhRUVHEx8f7exgiIgHFzL7/sXk6ZCQiIoACQUREPAoEEREBFAgiIuJRIIiICKBAEBERjwJBREQABYKISMDIOpbPo4vXkrb/aKU8f8B+MU1EJJh8tXEPU2IT2brvKO2bNeCGIR0r/DUUCCIi1djB7FweXbSWN1ZsI6pFA2ZPGMKQzi0q5bUUCCIi1dQHyTu5d14iuw/lcOvQztx5cXfqh9SutNdTIIiIVDN7DufwwII1LEzYTs+2jfnPuBj6tg+r9NdVIIiIVBPOOeZ/l8GD76zhSE4+f7qkO7cO7ULdOlVz/Y8CQUSkGsjIzOLeeUksXbeL/pFhPH5tX7q1aVylY1AgiIj4UUGB4/UVW5m2eB35BY6/XBnN+HOiqF3LTlh23qp0pi9JISMzi/CwUCaN6MHo/hEVNhYFgoiIn2zec4TJsQms2LyP87q25NFr+tCheYMSl523Kp2pcYlk5eYDkJ6ZxdS4RIAKCwUFgohIFcvLL+CFLzbz1AfrqVunFo9f25frY9pjduJeQaHpS1J+CINCWbn5TF+SokAQEQlEyRkHmRybQG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yMxC8IXBf51zcV65tPecrnG83d9PgJEE5/Y4F7jazLYAs4GLzOz/CM5tAYBzLsP7uQt4G98hj2DdHhV1v/pSUyBUEu/+0C8Ca51zTxaZVap7TlfVeCubmbUyszBvOhS4GFhHEG4P59xU51x751wUMBZY6pz7JUG4LQDMrKGZNS6cBi4FkgjS7eEq6H71ZX1xPSrnKoHz8O22JQDfeY/LgRbAR8AG72fzIuvcg+8KgRTgMn+/hwreHn2BVd72SAL+4tWDcnsUeY/D+N9VRkG5LfAdM1/tPdYA9wTz9vDeXz8g3vv3Mg9oVhXbQ60rREQE0CEjERHxKBBERARQIIiIiEeBICIigAJBREQ8CgQREQEUCCIi4vl/L/MRouRM+wkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X, y)\n",
    "plt.plot(X, y_pred)  #预测结果\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
